package com.quanyan.stadium.constants;

import java.math.BigDecimal;

/**
 * Created with IntelliJ IDEA.
 * User: zyq
 * Date: 2016/6/23 0023
 * Time: 14:55
 */

public abstract class RadarChartConstants {

    /*
    根据雷达图的计算规则，这里放一些用于计算的常量
    为了尽量不损失精度，参与计算的数据都用BigDecimal！
     */
    public final static BigDecimal dividNum = BigDecimal.valueOf(20D);
    public final static BigDecimal percentNum = BigDecimal.valueOf(0.6D); // 60%

    public final static double RATIO = 0.05;
    public final static double OFFICE_RATIO_GAME = 0.05;
    public final static double OPPOINT_RATIO_GAME = 0.01;
    public final static double PK_RATIO_GAME = 0.01;

    public final static double WIN = 1.5;
    public final static double EQUAL = 1;
    public final static double FAIL = -1;



    public static double getGameRatio(Integer type){
        switch (type){
            case 1:
                return 1;
            case 2:
                return 0.6;
            case 3:
                return 0.2;
            case 4:
                return 0.5;
        }
        return 1;
    }



    public enum  FootBallConstants{
        ST(1,"前锋"),
        AM(2,"中场/前腰"),
        DM(3,"后卫/后腰"),
        GK(4,"门将"),
        UNKNOWNFOOTBALLTYPE(-1,"");
        private Integer type;
        private String name;

        FootBallConstants(Integer type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }


        public String getName() {
            return name;
        }
        

        public static String getNameByType(Integer type) {
            FootBallConstants footBallConstants = null;
            switch (type) {
                case 1:
                    footBallConstants = FootBallConstants.ST;
                    break;
                case 2:
                    footBallConstants = FootBallConstants.AM;
                    break;
                case 3:
                    footBallConstants = FootBallConstants.DM;
                    break;
                case 4:
                    footBallConstants = FootBallConstants.GK;
                    break;
                default:
                    footBallConstants = FootBallConstants.UNKNOWNFOOTBALLTYPE;
            }
            return footBallConstants.getName();
        }
    }


    public enum  BasketBallConstants{

        C(1,"中锋"),
        PF(2,"大前锋"),
        PG(3,"小前锋"),
        SF(4,"控球后卫"),
        SG(5,"得分后卫"),
        UNKNOWNBASKETBALLTYPE(-1,"");

        private Integer type;
        private String name;

        BasketBallConstants(Integer type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        public static String getNameByType(Integer type) {
            BasketBallConstants basketBallConstants = null;
            switch (type) {
                case 1:
                    basketBallConstants = BasketBallConstants.C;
                    break;
                case 2:
                    basketBallConstants = BasketBallConstants.PF;
                    break;
                case 3:
                    basketBallConstants = BasketBallConstants.PG;
                    break;
                case 4:
                    basketBallConstants = BasketBallConstants.SF;
                    break;
                case 5:
                    basketBallConstants = BasketBallConstants.SG;
                    break;
                default:
                    basketBallConstants = BasketBallConstants.UNKNOWNBASKETBALLTYPE;
            }
            return basketBallConstants.getName();
        }
    }
}
